package org.smallframework.spring;

import org.springframework.transaction.annotation.Transactional;
import sf.core.DBObject;
import sf.database.dao.DBClient;
import sf.database.mapper.DaoMapperImpl;

import java.util.List;
import java.util.Map;

@Transactional(readOnly = true)
public class SpringDaoMapper<T extends DBObject> extends DaoMapperImpl<T> {
    public SpringDaoMapper(Class<T> domainClass, DBClient client) {
        super(domainClass, client);
    }

    @Transactional
    @Override
    public int merge(T entity) {
        return super.merge(entity);
    }

    @Transactional
    @Override
    public int insert(T t) {
        return super.insert(t);
    }

    @Transactional
    @Override
    public int[] insertBatch(List<T> list) {
        return super.insertBatch(list);
    }

    @Transactional
    @Override
    public int[] insertBatchFast(List<T> list) {
        return super.insertBatchFast(list);
    }

    @Transactional
    @Override
    public int updateById(T entity) {
        return super.updateById(entity);
    }

    @Transactional
    @Override
    public int update(T entity) {
        return super.update(entity);
    }

    @Transactional
    @Override
    public int[] updateBatch(List<T> entity) {
        return super.updateBatch(entity);
    }

    @Transactional
    @Override
    public int delete(T entity) {
        return super.delete(entity);
    }

    @Transactional
    @Override
    public int deleteById(Object... key) {
        return super.deleteById(key);
    }

    @Transactional
    @Override
    public int[] deleteInBatch(Iterable<T> entities) {
        return super.deleteInBatch(entities);
    }

    @Transactional
    @Override
    public void deleteAllInBatch() {
        super.deleteAllInBatch();
    }

    @Transactional
    @Override
    public int logicDelete(T entity) {
        return super.logicDelete(entity);
    }

    @Transactional
    @Override
    public int logicDeleteById(Object... key) {
        return super.logicDeleteById(key);
    }

    @Transactional
    @Override
    public T lock(T query) {
        return super.lock(query);
    }

    @Transactional
    @Override
    public int executeTemplate(String sql, Map<String, Object> paras) {
        return super.executeTemplate(sql, paras);
    }
}
